
#ifndef _Map_H
#define _Map_H



#include <iostream>
#include <list>

#include <SFML/Graphics.hpp>
#include <Box2D\Box2D.h>

#include "SFMLMappy.h"
#include "Parallax.h"

using namespace std;




enum dir 
{
     Left,
     Right,
     Up,
     Down
};





class c_Map : public SFMLMappy
{
      public:
		  c_Map();

		  //Register class
		  static bool Register_With_ScriptEngine();


//Variabls     
		  //get starting position
		    sf::Vector2f Get_StartPosition() { return start_pos; }

             
           //Get Size of map, in blocks and in pixels  
			 sf::Vector2f Get_BlockSize() { return size; }
		     sf::Vector2f Get_PixelSize() 
			 {  
				 sf::Vector2f pixel_size;
				 pixel_size.x = size.x * tile_dimensions.x;
				 pixel_size.y = size.y * tile_dimensions.y;

				 return pixel_size;
			 }
             
             //Get tile size(in pixels)
			 sf::Vector2i Get_TileSize() { return tile_dimensions; }

             
             //Map list of all the maps available
             vector <string> List;

			 //Maximum amount of maps
		     int Get_MaxMapCount() { return max_count; }
			 //Maximum amount of enemies
			 int Get_MaxEnemy() { return max_enemy; }
             
             
			 


//Map control funcitons
             void Set_Current(int mapNum);
             int  Get_Current();
             bool Setup_List(string cfg_file);
             void Reset();
			 void Change_Layers(const int layer);
			 void Update_Logic();
			 void Draw_Backgrounds();
			 void Draw_Foregrounds();
             void Draw(int layer);
//Loading functions
             bool Load();
             bool Load(int mapNum);
             bool Load_Next();
             bool Load_Previous();
             void Destroy();
           //  void effects_manager();

			  

			 //Start position
			 sf::Vector2f start_pos;

			 //gravity obviously
			 float gravity;
			 b2Vec2 savedGravity;

			 //pathfinding stuff
			 b2Vec2 pathStart;
			 b2Vec2 pathEnd;

		

		list<b2Body *> mesh_list;
		
		//Debug thingz
		std::vector< sf::Shape > shape_list;
	




protected:
             
		  
			
		 //size of the map (in blocks)
			 sf::Vector2f size;

		 //size of the tiles (in pixels)
			 sf::Vector2i tile_dimensions;



		    //Parallax scrolling Backgrounds
			vector< Parallax > Backgrounds;
			vector< Parallax > Foregrounds;

		 //Current map	
             int current_map; 
		 //how many maps there are
			 int max_count;

		//how many enemies there are
             int max_enemy;

		//info on the maps
             bool Get_Info(string datafile_loc);              
};


extern c_Map Map;


#endif
